desc.h, process.c:
[PATCH] Fixing TLS handling in x86-64 xenlinux
Some LTP testcases (pthreads) have exposed this bug (kill the kernel),
and the attached fixes the problem. With this, pth_str0? run fine, for
example. We'll continue to run LTP on x86-64 xenlinux to get all of them
pass.
Signed-off-by: Jun Nakajima <jun.nakajima@intel.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
struct user_desc ud = {
.base_addr = addr,
.limit = 0xfffff,
+ .contents = (3 << 3), /* user */
.seg_32bit = 1,
.limit_in_pages = 1,
.useable = 1,
mcl->op = __HYPERVISOR_update_descriptor; \
mcl->args[0] = virt_to_machine(&get_cpu_gdt_table(cpu) \
[GDT_ENTRY_TLS_MIN + i]); \
- mcl->args[1] = (unsigned long) ((u64 *) &next->tls_array[i]); \
- mcl->args[2] = (unsigned long) ((u64 *) &next->tls_array[i]); \
+ mcl->args[1] = next->tls_array[i]; \
mcl++; \
} \
} while (0)
extern struct desc_ptr idt_descr, cpu_gdt_descr[NR_CPUS];
-extern struct desc_ptr cpu_gdt_table[NR_CPUS][GDT_ENTRIES];
+extern struct desc_struct cpu_gdt_table[NR_CPUS][GDT_ENTRIES];
-#define get_cpu_gdt_table(_cpu) ((struct desc_ptr *)(cpu_gdt_descr[(_cpu)].address))
+#define get_cpu_gdt_table(_cpu) ((struct desc_struct *)(cpu_gdt_descr[(_cpu)].address))
#define load_TR_desc() asm volatile("ltr %w0"::"r" (GDT_ENTRY_TSS*8))
#define load_LDT_desc() asm volatile("lldt %w0"::"r" (GDT_ENTRY_LDT*8))